/* 全局样式 */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #0066cc;
    transition: color 0.3s;
}

a:hover {
    color: #004499;
}

/* 导航栏样式 */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 10px 0;
}

.navbar-a{
    text-align: center;
    padding: 10px 0;
    color: white;
    background-color: #050708;
}

.navbar-a a {
    color: white;
    padding: 5px 15px;
    margin: 0 5px;
    border-radius: 3px;
}

.navbar a {
    color: white;
    padding: 5px 15px;
    margin: 0 5px;
    border-radius: 3px;
}

.navbar a:hover {
    background-color: #34495e;
    color: #ecf0f1;
}

.user-info {
    padding-right: 100px;
    text-align: right;
}

.main{
    display: flex;
    height: 89vh; /* 占满整个视口高度 */
}

/* 侧边栏样式 */
.sidebar {
    background-color: #34495e;
    color: white;
    padding: 20px;
    min-height: 500px;
    width: 19%;
}

.sidebar a {
    color: #ecf0f1;
    display: block;
    padding: 10px;
    margin: 5px 0;
    border-radius: 3px;
}

.sidebar a:hover {
    background-color: #2c3e50;
}

/* 内容区域样式 */
.content {
    width: 79%;
    padding: 20px;
    background-color: white;
    min-height: 500px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.content2 {
    width: 100%;
    padding: 20px;
    background-color: white;
    min-height: 500px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    height: 100%;
}

/* 产品列表样式 */
.product-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0;
    margin: 0;
}

.product-item {
    width: 30%;
    margin-bottom: 30px;
    background: white;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 5px;
    text-align: center;
    transition: transform 0.3s;
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-item img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 12px;
    text-align: left;
}

th {
    background-color: #2c3e50;
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #e6f7ff;
}

/* 按钮样式 */
button, input[type="button"], input[type="submit"] {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover, input[type="button"]:hover, input[type="submit"]:hover {
    background-color: #2980b9;
}

/* 表单样式 */
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    max-width: 300px;
    margin: 5px 0;
}

/* 详情页样式 */
.product-detail {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.product-detail img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* 购物车样式 */
.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.cart-item img {
    width: 80px;
    height: 80px;
    margin-right: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product-item {
        width: 100%;
    }
    
    .sidebar {
        width: 100%;
        min-height: auto;
    }
}
/* ========== 注册页面 register.html 专属样式 ========== */
.register-form {
    max-width: 600px;
    margin: 30px auto;
    padding: 20px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.register-form table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 15px;
}

.register-form td {
    padding: 8px;
}

.register-form input[type="text"],
.register-form input[type="password"],
.register-form input[type="email"],
.register-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.register-form input[type="submit"],
.register-form input[type="reset"] {
    width: 120px;
    margin: 0 10px;
}

/* ========== 登录页面 login.html 专属样式 ========== */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
}

.login-container h1 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.login-container input[type="submit"] {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
}

/* ========== 用户中心 user.html 专属样式 ========== */
.user-dashboard {
    padding: 20px;
    background: white;
    min-height: 300px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.user-dashboard h2 {
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
/* ========== 购物车/订单页面左右分栏布局 ========== */
.account-container {
    display: flex;
    min-height: calc(100vh - 120px); /* 减去顶部导航高度 */
}

.account-sidebar {
    width: 200px;
    background: #34495e;
    padding: 20px 0;
}

.account-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.account-menu li {
    padding: 12px 20px;
    border-left: 4px solid transparent;
    transition: all 0.3s;
}

.account-menu li:hover {
    background: #2c3e50;
    border-left: 4px solid #3498db;
}

.account-menu a {
    color: #ecf0f1;
    display: block;
}

.account-content {
    flex: 1;
    padding: 20px;
    background: #fff;
}

.order-table {
    width: 100%;
    margin-top: 20px;
}

.order-table th {
    background: #2c3e50;
    color: white;
    padding: 12px;
    text-align: left;
}

.order-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.order-actions a {
    margin-right: 10px;
    color: #3498db;
}

.order-actions a:hover {
    text-decoration: underline;
}

/* ===== 商品列表容器 ===== */
.product-list-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.category-title {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* ===== 商品网格布局 ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* ===== 商品卡片样式 ===== */
.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ===== 可点击的商品链接 ===== */
.product-link {
    display: block;
    text-decoration: none;
    color: inherit; /* 继承父级文字颜色 */
    height: 100%;
}

/* ===== 商品图片 ===== */
.product-image {
    width: 100%;
    height: 160px;
    object-fit: contain;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

/* ===== 商品信息 ===== */
.product-info {
    padding: 15px;
}

.product-name {
    font-size: 1rem;
    margin: 0 0 8px 0;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0;
}

/* ===== 响应式调整 ===== */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .product-image {
        height: 120px;
    }
}

.register-link {
    margin-top: 15px;
    text-align: center;
    color: #555;
}

.register-link a {
    color: #3498db;
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

.form-actions {
    text-align: center;
    margin-top: 20px;
}

.back-button-container {
    text-align: center;
    margin-top: 15px;
}

.back-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #95a5a6;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.back-button:hover {
    background-color: #7f8c8d;
    color: white;
}

@media (max-width: 600px) {
    .back-button {
        width: 100%;
        margin: 5px 0;
    }
}